<template>
    <div class="outpatient-detail">
        <h2 class="title">就诊详情
          <spen @click="back">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            返回上一页</spen>
        </h2>
        <div class="card">
            <DetailInfo :dataList="dataInfo"></DetailInfo>
        </div>

    </div>
</template>
<script>
import DetailInfo from '@/components/detail-info/index.vue'
import { listVisit, selectVisit } from "@/api/system/nation";
export default {
    name: 'OutpatientDetail',
    components: {
        DetailInfo,
    },
    data() {
        return {
            dataInfo: [
                {
                    label: '患者姓名',
                    value: '王方'
                },
                {
                    label: '医院',
                    value: '板桥'
                },
                {
                    label: '主诉内容',
                    value: '头昏'
                },
                {
                    label: '就诊流水号',
                    value: '1273278'
                },
                {
                    label: '患者性别',
                    value: '计划生育预警'
                },
                {
                    label: '就诊科室',
                    value: '皮肤科'
                },
                {
                    label: '疾病名称',
                    value: '感染病毒'
                },
                {
                    label: '就诊日期',
                    value: '2024-03-12 15:20:00'
                },
                {
                    label: '患者年龄',
                    value: '30'
                },
                {
                    label: '医生姓名',
                    value: '王博一'
                },
                {
                    label: '就诊类型',
                    value: '专家/普通/急诊'
                },
                {
                    label: '就诊',
                    value: '初诊/复诊'
                },
                {
                    label: '医生编号',
                    value: '15921798'
                },
                {
                    label: '医生身份证号',
                    value: '45646'
                },
            ]
        }
    },
  created() {
    const number = this.$route.params.number.clinic_id;
	console.log(number)
    if (number) {
      this.getList(number);
    }
  },
  methods: {
    getList(row) {
      selectVisit(row).then(response => {
        let patientSex=''
        if(response.data.patientSex == 1 ){
          patientSex = '男'
        } else {
          patientSex = '女'
        }
		let firstVisit=''
		if(response.data.firstVisit == '0' ){
		  firstVisit = '初诊'
		} else if(response.data.firstVisit == '0') {
		  firstVisit = '复诊'
		}else{
			firstVisit='无'
		}
		let medicalType=''
		if(response.data.medicalType == '0' ){
		  medicalType = '普通门诊'
		} else if(response.data.medicalType == '1') {
		  medicalType = '专家门诊'
		}else if(response.data.medicalType == '2') {
		  medicalType = '急诊'
		}else{
			medicalType='无'
		}
        this.dataInfo = [
          {
            label: '患者姓名',
            value: response.data.patientName
          },
          {
            label: '医院',
            value: this.$route.params.number.hospitalName
          },
          {
            label: '主诉内容',
            value: response.data.diagnosisName
          },
          {
            label: '就诊流水号',
            value: response.data.clinic_id
          },
          {
            label: '患者性别',
            value: patientSex
          },
          {
            label: '就诊科室',
            value: response.data.departmentName
          },
          {
            label: '疾病名称',
            value: response.data.diagnosisName
          },
          {
            label: '就诊日期',
            value: response.data.clinicTime
          },
          {
            label: '患者年龄',
            value: response.data.patientAge
          },
          {
            label: '医生姓名',
            value: response.data.doctorName
          },
          {
            label: '就诊类型',
            value: medicalType
          },
          {
            label: '就诊',
            value: firstVisit
          },
          {
            label: '医生编号',
            value: response.data.doctorCode
          },
          {
            label: '医生身份证号',
            value: response.data.idCard
          },
        ]

        //this.form.hospitalName = row.hospitalName
      });
    },
    back() {
      this.$router.go(-1); // 返回上一页
    }
  }
}
</script>
<style scoped lang="scss">
.outpatient-detail {
    height: 100%;
    display: flex;
    flex-direction: column;

}
.card {
    background-color: #fff;
    padding: 5px 13px 19px;
    margin-top: 14px;
}
.content {
    padding-top: 31px;
    display: flex;
    flex-direction: column;
    height: 100%;
    .item {
        display: flex;
        line-height: 40px;
        .label {
            width: 120px;
            font-weight: 500;
            font-size: 16px;
            color: #8B8B8B;
        }
        .value {
            font-weight: 500;
            font-size: 16px;
            color: #4B4B4B;
        }
    }
}

</style>
